<?php
namespace app\common\model;

use think\Model;

class Coupons extends Model
{
    protected $pk = 'adm_id';
    protected $type=[
        'cp_start_time'=>'timestamp:Y-m-d H:i:s',
        'cp_end_time'=>'timestamp:Y-m-d H:i:s',
        'cp_use_time'=>'timestamp:Y-m-d H:i:s'
    ];
    public function role(){
        return $this->belongsTo('AdminsRole','adm_role','role_id')->field('role_id,role_name');
    }

    public function getAdmStatusAttr($value)
    {
        $status = [0=>'禁用',1=>'启用'];
        return $status[$value];
    }
}